package com.smedi.ismedi.organization.api.feign;

import com.smedi.ismedi.organization.api.dto.request.*;
import com.smedi.ismedi.organization.api.dto.response.HrOrganizationResponse;
import com.smedi.ismedi.organization.api.dto.response.SendMessageByJobRespose;
import com.smedi.ismedi.organization.api.dto.response.SendMessageByRoleRespose;
import com.smedi.ismedi.organization.api.dto.response.resp.AllOrganizationResp;
import com.smedi.ismedi.organization.api.dto.response.resp.OrganizationResp;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = {"企业组织架构维护接口"})
@FeignClient(name = "ismedi-organization")
@RequestMapping(value = "/api/v1/organization/hr")
public interface RemoteHrOrganizationFeignApi {
    /**
     * 保存行政组织信息
     *
     * @param hrOrganizationRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存组织信息")
    @PostMapping(value = "/save")
    ResponseData<HrOrganizationResponse> postSaveHrOrganization(@RequestBody HrOrganizationRequest hrOrganizationRequest);

    /**
     * 保存行政组织信息
     *
     * @param hrOrganizationId
     */
    @ApiOperation(httpMethod = "DELETE", value = "删除组织信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @DeleteMapping(value = "/delete")
    ResponseData<Boolean> deleteHrOrganization(@RequestParam("hrOrganizationId") Long hrOrganizationId);

    /**
     * 查询行政组织树
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "查询组织树")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/getHrOrganizationTree")
    ResponseData<List<HrOrganizationResponse>> getHrOrganizationTree(@RequestParam(value = "hrOrganizationId", required = false) Long hrOrganizationId);

    /**
     * 无安全性查询组织树
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "无安全性查询组织树")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/getHrOrganizationTreeNoSecurity")
    ResponseData<List<HrOrganizationResponse>> getHrOrganizationTreeNoSecurity(@RequestParam(value = "hrOrganizationId", required = false) Long hrOrganizationId);

    /**
     * 查询行政组织视图
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "查询组织视图")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/getHrOrganizationView")
    ResponseData<HrOrganizationResponse> getHrOrganizationView(@RequestParam(value = "hrOrganizationId") Long hrOrganizationId);

    /**
     * 判断当前职能组织是否可以用
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "判断当前组织是否可以用")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/checkAvailable")
    ResponseData<Boolean> getCheckAvailable(@RequestParam(value = "hrOrganizationId") Long hrOrganizationId);

    /**
     * 获取当前组织下的所有子节点组织id及其本身
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取当前组织下的所有子节点组织id及其本身")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class)
    })
    @GetMapping(value = "/getHrOrganizationChildrenOrgIdList")
    ResponseData<List<Long>> getHrOrganizationChildrenOrgIdList(@RequestParam(value = "hrOrganizationId") Long hrOrganizationId);

    /**
     * 获取当前组织下的所有子节点组织id与组织名称及其本身
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取当前组织下的所有子节点组织id与组织名称及其本身")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class)
    })
    @GetMapping(value = "/getHrOrganizationChildrenOrgMap")
    ResponseData<Map<Long, String>> getHrOrganizationChildrenOrgMap(@RequestParam(value = "hrOrganizationId") Long hrOrganizationId);

    /**
     * 判断当前职能组织下是否允许创建项目
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "判断当前职能组织下是否允许创建项目")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/checkHrOrganizationCanHasProjectAvailable")
    ResponseData<Boolean> getCheckHrOrganizationCanHasProjectAvailable(@RequestParam(value = "hrOrganizationId") Long hrOrganizationId);

    /**
     * 根据企业组织id数组获取企业组织信息
     *
     * @param hrOrganizationIds
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据企业组织id数组获取企业组织信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationIds", value = "企业组织id数组", dataType = "List", dataTypeClass = List.class),
    })
    @GetMapping(value = "/queryHrOrganizationList")
    ResponseData<List<HrOrganizationResponse>> getQueryHrOrganizationList(@RequestParam(value = "hrOrganizationIds") List<Long> hrOrganizationIds);

    /**
     * 根据组织名称模糊查询企业组织列表
     *
     * @param fullName
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据组织名称模糊查询企业组织列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "fullName", value = "企业组织名称", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping(value = "/queryHrOrganizationListByFullName")
    ResponseData<List<HrOrganizationResponse>> getQueryHrOrganizationListByFullName(@RequestParam(value = "fullName") String fullName);

    /**
     * 根据组织名称列表查询企业组织列表
     *
     * @param fullNameList
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据组织名称列表查询企业组织列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "fullName", value = "企业组织名称", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping(value = "/queryHrOrganizationListByFullNameList")
    ResponseData<List<HrOrganizationResponse>> getQueryHrOrganizationListByFullNameList(@RequestParam(value = "fullName") List<String> fullNameList);

    /**
     * 根据企业组织id获取到根节点
     *
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据企业组织id获取到根节点")
    @GetMapping(value = "/getHrOrganizationRoot")
    ResponseData<HrOrganizationResponse> getHrOrganizationRoot();

    /**
     * 获取所有企业组织下的项目管理组织清单
     *
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取所有企业组织下的项目管理组织清单")
    @GetMapping(value = "/queryAllProjectManagementHROrganizationList")
    ResponseData<List<HrOrganizationResponse>> getQueryAllProjectManagementHROrganizationList();

    /**
     * 获取所有企业组织下的项目管理组织清单
     *
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取所有企业组织下的项目管理组织清单(为统计写的接口)")
    @GetMapping(value = "/queryAllProjectManagementHROrganizationListNew")
    ResponseData<List<HrOrganizationResponse>> getQueryAllProjectManagementHROrganizationListNew();

    /**
     * 根据用户分配的组织id获取顶部菜单切换所显示的组织信息
     *
     * @param assignmentHrOrganizationIds
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据用户分配的组织id获取顶部菜单切换所显示的组织信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "assignmentHrOrganizationIds", value = "企业组织id数组", dataType = "List", dataTypeClass = List.class),
            @ApiImplicitParam(paramType = "query", name = "showAll", value = "显示所有", dataType = "boolean", dataTypeClass = Boolean.class),
    })
    @GetMapping(value = "/getTopHrOrganizationScopeList")
    ResponseData<HrOrganizationResponse> getTopHrOrganizationScopeList(@RequestParam("assignmentHrOrganizationIds") List<Long> assignmentHrOrganizationIds,
                                                                       @RequestParam("showAll") boolean showAll);

    /**
     * 获取所有企业组织下的特定类型的组织清单
     *
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "获取所有企业组织下的特定类型的组织清单")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "isCompany", value = "是否包含公司", dataType = "boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(paramType = "query", name = "isCompanyLeader", value = "是否包含公司领导", dataType = "boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(paramType = "query", name = "isCompanyManagementOrganization", value = "是否包含公司管理组织", dataType = "boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(paramType = "query", name = "isProjectManagementOrganization", value = "是否包含项目管理组织", dataType = "boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(paramType = "query", name = "isSubordinateOrganization", value = "是否包含下级部门", dataType = "boolean", dataTypeClass = Boolean.class),
    })
    @GetMapping(value = "/queryAllHROrganizationListByType")
    ResponseData<List<HrOrganizationResponse>> getQueryAllHROrganizationListByType(@RequestParam("isCompany") boolean isCompany,
                                                                                   @RequestParam("isCompanyLeader") boolean isCompanyLeader,
                                                                                   @RequestParam("isCompanyManagementOrganization") boolean isCompanyManagementOrganization,
                                                                                   @RequestParam("isProjectManagementOrganization") boolean isProjectManagementOrganization,
                                                                                   @RequestParam("isSubordinateOrganization") boolean isSubordinateOrganization);

    /**
     * 根据企业组织id获取父组织链式id
     *
     * @param hrOrganizationId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据企业组织id获取父组织链式id")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hrOrganizationId", value = "企业组织id", dataType = "Long", dataTypeClass = Long.class)
    })
    @GetMapping(value = "/getParentHrOrganizationIdsByHrOrganizationId")
    ResponseData<List<Long>> getParentHrOrganizationIdsByHrOrganizationId(@RequestParam("hrOrganizationId") Long hrOrganizationId);

    /**
     * 根据内部用户分配的企业组织id获取所有企业组织
     *
     * @param internalAssignmentHrOrganizationIds
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据内部用户分配的企业组织id获取所有企业组织")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "internalAssignmentHrOrganizationIds", value = "分配的企业组织id数组", dataType = "List", dataTypeClass = List.class)
    })
    @GetMapping(value = "/getAllHrOrganizationIdsWhenYouAreInCompanyLevel")
    ResponseData<List<Long>> getAllHrOrganizationIdsWhenYouAreInCompanyLevel(@RequestParam("internalAssignmentHrOrganizationIds") List<Long> internalAssignmentHrOrganizationIds);

    /**
     * 交换两个企业组织的排序，并获取企业组织树
     *
     * @param twoHrOrganizationNodeRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "交换两个企业组织的排序，并获取企业组织树")
    @PostMapping(value = "/exchangeTwoHrOrganizationNodeSort")
    ResponseData<List<HrOrganizationResponse>> postExchangeTwoHrOrganizationNodeSort(@RequestBody TwoHrOrganizationNodeRequest twoHrOrganizationNodeRequest);

    /**
     * 获取全部的企业组织列表
     *
     * @return ResponseData<List<HrOrganizationResponse>>
     */
    @ApiOperation(httpMethod = "GET", value = "获取全部的企业组织列表")
    @GetMapping(value = "/getAllHrOrganizationList")
    @Deprecated
    ResponseData<List<HrOrganizationResponse>> getAllHrOrganizationList();

    /**
     * 根据Ids获取企业组织
     *
     * @param organizationIds 组织Ids
     * @return ResponseData<List<HrOrganizationResponse>>
     */
    @ApiOperation(httpMethod = "GET", value = "根据Ids获取企业组织")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "organizationIds", value = "组织Ids", dataType = "List", dataTypeClass = List.class)
    })
    @GetMapping(value = "/getHrOrganizationList")
    @Deprecated
    ResponseData<List<HrOrganizationResponse>> getHrOrganizationList(@RequestParam("organizationIds") List<Long> organizationIds);

    /**
     * 查询 企业 详情
     *
     * @param organizationOneQueryRequest 企业 详情 请求
     * @return ResponseData<List<OrganizationResp>>
     */
    @PostMapping(value = "/one")
    @ApiOperation(httpMethod = "POST", value = "查询 企业组织 单一")
    ResponseData<OrganizationResp> getOrganizationOne(@RequestBody OrganizationOneQueryRequest organizationOneQueryRequest);

    /**
     * 查询 企业 列表
     *
     * @param organizationListQueryRequest 企业 列表 请求
     * @return ResponseData<List<OrganizationResp>>
     */
    @PostMapping(value = "/list")
    @ApiOperation(httpMethod = "POST", value = "查询 企业组织 列表")
    ResponseData<List<OrganizationResp>> getOrganizationList(@RequestBody OrganizationListQueryRequest organizationListQueryRequest);

    /**
     * 查询 企业 列表（不需要token）
     *
     * @param organizationListQueryRequest 企业 列表 请求
     * @return ResponseData<List<OrganizationResp>>
     */
    @PostMapping(value = "/list/no-token")
    @ApiOperation(httpMethod = "POST", value = "查询 企业组织 列表（不需要token）")
    @Deprecated
    ResponseData<List<OrganizationResp>> getOrganizationListWithoutToken(@RequestBody OrganizationListQueryRequest organizationListQueryRequest);


    @PostMapping("/updateByName")
    @ApiOperation(httpMethod = "POST",value = "更新 企业组织")
    ResponseData<Long> updateByName(@RequestBody HrOrgUpdateRequest orgUpdateRequest);

    @PostMapping("/all")
    @ApiOperation(httpMethod = "GET",value = "查询 企业组织 列表")
    @Deprecated
    ResponseData<List<AllOrganizationResp>> getOrgResponseData(@RequestBody List<Long> ids);

    @PostMapping("/sendMessageByRoleNotExists")
    @ApiOperation(httpMethod = "POST",value = "短信提醒需配置组织角色")
    ResponseData<SendMessageByRoleRespose> sendMessageByRoleNotExists(@Validated  @RequestBody SendMessageByRoleRequest sendMessageByRoleRequest);

    @PostMapping("/sendMessageByJobNotExists")
    @ApiOperation(httpMethod = "POST",value = "短信提醒需配置项目职务")
    ResponseData<List<SendMessageByJobRespose>> sendMessageByJobNotExists(@Validated @RequestBody SendMessageByJobRequest sendMessageByJobRequest);
}
